#!/bin/bash
rm -rf dist/*

workDir=$(pwd)
cd $workDir/src/org/ligson/treesize

appName="treesize"

echo "build linux amd64"
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -ldflags '-w -s' -o $appName-linux-amd64
mv $appName-linux-amd64 $workDir/dist/$appName-linux-amd64

echo "build darwin amd64"
GOARCH=amd64 GOOS=darwin go build -ldflags '-w -s' -o $appName-darwin-amd64
mv $appName-darwin-amd64 $workDir/dist/$appName-darwin-amd64

#echo "build linux arm64 v7"
#GOARM=7 GOARCH=arm64 GOOS=linux go build -ldflags '-w -s' -o $appName-linux-arm64-v7
#mv $appName-linux-arm64-v7 $workDir/dist/$appName-linux-arm64-v7

echo "build windows amd64"
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags '-w -s' -o $appName-linux-arm64-v7

#echo "build linux arm64 v8"
#GOARM=8 GOARCH=arm64 GOOS=linux go build -ldflags '-w -s' -o $appName-linux-arm64-v8
#mv $appName-linux-arm64-v8 $workDir/dist/$appName-linux-arm64-v8

echo "build success,dist files:"

ls  $workDir/dist/
